/*
 * Wazuh Vulnerability Scanner - Unit Tests
 * Copyright (C) 2015, Wazuh Inc.
 * September 21, 2023.
 *
 * This program is free software; you can redistribute it
 * and/or modify it under the terms of the GNU General Public
 * License (version 2) as published by the FSF - Free Software
 * Foundation.
 */

#include "databaseFeedManager_test.hpp"
#include "databaseFeedManager/databaseFeedManager.hpp"
#include <external/nlohmann/json.hpp>
#include <memory>

/*
 * @brief Test instantiation of the DatabaseFeedManager class.
 */
TEST_F(DatabaseFeedManagerTest, TestInstantiationOfTheDatabaseFeedManagerClass)
{
    // TODO: Remove GTEST_SKIP and add EXPECTS once the implementation of the 'Indexer Connector' module is completed
    GTEST_SKIP();
    std::shared_ptr<IndexerConnector> indexerConnector;
    std::atomic<bool> shouldStop {false};
    std::shared_mutex mutex;

    // Instantiation of the DatabaseFeedManager class.
    EXPECT_NO_THROW(std::make_shared<DatabaseFeedManager>(indexerConnector, shouldStop, mutex));
}

/*
 * @brief Test update method of the DatabaseFeedManager class.
 */
TEST_F(DatabaseFeedManagerTest, TestUpdateOfTheDatabaseFeedManagerClass)
{
    // TODO: Remove GTEST_SKIP and add EXPECTS once the implementation of the 'Indexer Connector' module is completed
    GTEST_SKIP();
    std::shared_ptr<IndexerConnector> indexerConnector;
    std::shared_ptr<DatabaseFeedManager> databaseFeedManager;
    nlohmann::json data;
    std::atomic<bool> shouldStop {false};
    std::shared_mutex mutex;

    // Instantiation of the DatabaseFeedManager class.
    EXPECT_NO_THROW(databaseFeedManager = std::make_shared<DatabaseFeedManager>(indexerConnector, shouldStop, mutex));

    EXPECT_NO_THROW(databaseFeedManager->update(data));
}
